<?php
    if ($_COOKIE['LOG'] == false) {
        header('Location: ../index.php');
    }
    include_once '../config.php';
?>
<!DOCTYPE html>
<html>
    <head>
        <title>WeZett v1.0</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <style type="text/css" media="screen">@import "../jqtouch/jqtouch.css";</style>
        <style type="text/css" media="screen">@import "../theme/theme.css";</style>
        <script src="../jqtouch/jquery-1.4.2.js" type="text/javascript" charset="utf-8"></script>
        <script src="../jqtouch/jqtouch.js" type="application/x-javascript" charset="utf-8"></script>
        <script type="text/javascript" charset="utf-8">
            var jQT = new $.jQTouch({
                icon: 'wzicon.png',
                icon4: 'wzicon.png',
                addGlossToIcon: false,
                startupScreen: 'start.png',
                statusBar: 'grey',
                preloadImages: [
                    'theme/img/activeButton.png',
                    'theme/img/back_button.png',
                    'theme/img/back_button_clicked.png',
                    'theme/img/blueButton.png',
                    'theme/img/button.png',
                    'theme/img/button_clicked.png',
                    'theme/img/grayButton.png',
                    'theme/img/greenButton.png',
                    'theme/img/redButton.png',
                    'theme/img/whiteButton.png',
                    'theme/img/loading.gif'
                    ]
            });
            
            function new_km() {
                if(document.getElementById('new_km_check').checked){
                    document.getElementById('p_km').style.display = "none";
                    document.getElementById('km_name').style.display = "";
                    document.getElementById('km_vorname').style.display = "";
                    document.getElementById('km_phone').style.display = "";
                    document.getElementById('km_email').style.display = "";
                    document.getElementById('km_mobil').style.display = "";
                } else {
                    document.getElementById('p_km').style.display = "";
                    document.getElementById('km_name').style.display = "none";
                    document.getElementById('km_vorname').style.display = "none";
                    document.getElementById('km_phone').style.display = "none";
                    document.getElementById('km_email').style.display = "none";
                    document.getElementById('km_mobil').style.display = "none";    
                }
            }
            
        </script>
        <style type="text/css" media="screen">
            #jqt.fullscreen #home .info {
                display: none;
            }
            div#jqt #about {
                padding: 100px 10px 40px;
                text-shadow: rgba(255, 255, 255, 0.3) 0px -1px 0;
                font-size: 13px;
                text-align: center;
            }
            div#jqt #about p {
                margin-bottom: 8px;
            }
            div#jqt #about a {
                color: #fff;
                font-weight: bold;
                text-decoration: none;
            }
        </style>
    </head>
    <body>
        <div id="jqt">
            <div id="projekte">
                <div class="toolbar">
                    <h1>Projekte</h1>
                    <a href="javascript:window.location = '../index2.php'" class="button leftButton slideright">Home</a>
                    <a href="javascript:window.location = 'add.php'" class="button add slideleft">+</a>
                </div>
                <div id="pliste">
                    <h2>Aktuelles Geschäftsjahr <?php echo date('Y'); ?></h2>
                </div>
                <ul class="metal">
                    <?php
                        $sql = "SELECT project_nr, p_name, get, client_id FROM project ORDER BY project_nr DESC";
                        $result = mysql_query($sql);
                        
                        if (mysql_num_rows($result) > 0) {
                            while ($data = mysql_fetch_array($result)) {
                                if ($data['get'] == 0) {
                                    $status = '<font style="color:#2666db">Neu</font>';
                                } else if ($data['get'] == 1) {
                                    $status = 'Ja';
                                } else {
                                    $status = '<font style="color:red">Nein</font>';
                                }
                                echo '<li><a href="edit.php?project_nr=' . $data['project_nr'] .
                                        '&client_id=' . $data['client_id'] . '"><small>' . $status . '</small> A '
                                        . $data['project_nr'] . ' <em>' . $data['p_name'] . '</em></a></li>';
                            }
                        }
                    ?>
                </ul>
            </div>
        </div>
    </body>
</html>
